package com.beaut.project.control;


import com.beaut.project.service.XMAssistService;
import com.beaut.project.service.XMService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 项目模块管理
 * @author LJS
 *
 */
@Controller
@RequestMapping("/xm")
public class XMController  extends BaseControl{
	@Autowired 
	XMService xmService;
	@Autowired 
	XMAssistService xmAssistService;
	
	@RequestMapping(value = "/checkSameXMCode", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String checkSameXMCode(HttpServletRequest request) {
		return xmService.checkSameXMCode(requestParameterToMap(request));
	}
	@RequestMapping(value = "/xmFinishBalanceStatus", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String xmFinishBalanceStatus(HttpServletRequest request) {
		return xmService.xmFinishBalanceStatus(requestParameterToMap(request));
	}
	
    @RequestMapping(value = "/addXM", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXM(HttpServletRequest request) {
    	
    	return xmService.addXM(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/updateXM", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXM(HttpServletRequest request) {
    	
    	return xmService.updateXM(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/closeXm", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String closeXm(HttpServletRequest request) {
    	
    	return xmService.closeXm(requestParameterToMapUser(request));
    }
    /**
    * 撤销项目（未完工的项目）
    * @author xf
    * @Time 2017-02-08
    *
    */

    @RequestMapping(value = "/cancelXm", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String cancelXm(HttpServletRequest request) {

        return xmService.cancelXm(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/getXM", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXM(HttpServletRequest request) {
    	return xmService.getXMById(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/getXmIsHas", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmIsHas(HttpServletRequest request) {
    	return xmService.getXmIsHas(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/getAlreadyOutInvoice", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getAlreadyOutInvoice(HttpServletRequest request) {
    	return xmService.getAlreadyOutInvoice(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/getEndInMoneyXMById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getEndInMoneyXMById(HttpServletRequest request) {
    	return xmService.getEndInMoneyXMById(requestParameterToMapUser(request));
    }   
    @RequestMapping(value = "/getBalancePayStatus", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getBalancePayStatus(HttpServletRequest request) {
    	return xmService.getBalancePayStatus(requestParameterToMapUser(request));
    } 
    @RequestMapping(value = "/getXmHasFinance", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmHasFinance(HttpServletRequest request) {
    	return xmService.getXmHasFinance(requestParameterToMapUser(request));
    }   
    @RequestMapping(value = "/getXMGDSets", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXMGDSets(HttpServletRequest request) {
    	
    	return xmService.getXMGDSets(requestParameterToMapUser(request));
    }
    
    @RequestMapping(value = "/getXmvaluationById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmvaluationById(HttpServletRequest request) {
    	
    	return xmService.getXmvaluationById(requestParameterToMapUser(request));
    }
    
    @RequestMapping(value = "/listInitGDSetByXMId", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listInitGDSetByXMId(HttpServletRequest request) {
    	
    	return xmService.listInitGDSetByXMId(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/listXMProcessStatuc", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listXMProcessStatuc(HttpServletRequest request) {
    	
    	return xmService.listXMProcessStatuc();
    }
    @RequestMapping(value = "/listPageXMBase", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMBase(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXMBase(map);
    }
    @RequestMapping(value = "/listPageWarehouseXM", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageWarehouseXM(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	return xmService.listPageWarehouseXM(map);
    }
    @RequestMapping(value = "/listPageXMBaseEnd", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMBaseEnd(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXMBaseEnd(map);
    }
    @RequestMapping(value = "/listPageXMAndGdClose", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMAndGdClose(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXMAndGdClose(map);
    }
    
    @RequestMapping(value = "/listAllPageGDSet", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listAllPageGDSet(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	return xmService.listAllPageGDSet(map);
    }
    @RequestMapping(value = "/listPageEvaluation", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageEvaluation(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageEvaluation(map);
    }
    @RequestMapping(value = "/listPageXmReimDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXmReimDetail(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXmReimDetail(map);
    }
    @RequestMapping(value = "/listPageBorrowMaterial", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageBorrowMaterial(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageBorrowMaterial(map);
    }
    /**
     * 根据项目合同id查询信息
     * @param request
     * @return
     */
    @RequestMapping(value = "/getXmContractById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmContractById(HttpServletRequest request) {
    	return xmService.getXmContractById(requestParameterToMapUser(request));
    }
    /**
     * 项目合同管理
     * @param request
     * @return
     */
    @RequestMapping(value = "/listPageXmContract", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXmContract(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXmContract(map);
    }
    /**
     * 项目合同添加
     * @param request
     * @return
     */
    @RequestMapping(value = "/addContract", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addContract(HttpServletRequest request) {
    	return xmService.addContract(requestParameterToMapUser(request));
    }
    /**
     * 项目合同删除
     */
    @RequestMapping(value = "/deleteContract", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String deleteContract(HttpServletRequest request) {
    	return xmService.deleteContract(requestParameterToMap(request));
    }
    /**
     * 项目合同编辑操作
     */
    @RequestMapping(value = "/updateContract", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateContract(HttpServletRequest request) {
    	
    	return xmService.updateContract(requestParameterToMapUser(request));
    }
    /**
     * 项目考评添加操作
     */
    @RequestMapping(value = "/addXmEvaluation", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXmEvaluation(HttpServletRequest request) {
    	
    	return xmService.addXmEvaluation(requestParameterToMap(request));
    }
    /**
     * 项目考评编辑操作
     */
    @RequestMapping(value = "/updateXmEvaluation", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXmEvaluation(HttpServletRequest request) {
    	
    	return xmService.updateXmEvaluation(requestParameterToMap(request));
    }
    @RequestMapping(value = "/listGdByXmId", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listGdByXmId(HttpServletRequest request) {
    	return xmService.listGdByXmId(requestParameterToMapUser(request));
    }
    @RequestMapping(value = "/updateGdSets", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateGdSets(HttpServletRequest request) {
    	
    	Map<String,Object> m=requestParameterToMapUser(request);
    	String rts= xmService.updateGdSets(m);
    	xmAssistService.updateStartTimeAndGDSetByXM(m);
    	
    	return rts;
    }
  //转移到workFlowControll  
//    @RequestMapping(value = "/flowBackToXMBaseStatus", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
//    public @ResponseBody String flowBackToXMBaseStatus(HttpServletRequest request) {
//    	Map<String,Object> m=requestParameterToMapUser(request);
//    		m.put("xm_id", m.get("key"));
//    	 xmService.flowBackToXMBaseStatus(m);
//    	 xmAssistService.updateStartTimeAndGDSetByXM(m);
//    	 return "1";
//    }
//    
    /**
     * 项目验收管理
     */
    @RequestMapping(value = "/listPageCheck", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageCheck(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageCheck(map);
    }
    /**
     * 部门列表
     */
    @RequestMapping(value = "/listXmDept", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listXmDept(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	return xmService.listXmDept(requestParameterToMap(request));
    }
    /**
     * 项目经济考评明细
     */
    @RequestMapping(value = "/listXmvaluationDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listXmvaluationDetail(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	return xmService.listXmvaluationDetail(requestParameterToMap(request));
    }
    /**
     * 项目经济考评删除
     */
    @RequestMapping(value = "/deleteXmEvaluation", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String deleteXmEvaluation(HttpServletRequest request) {
    	return xmService.deleteXmEvaluation(requestParameterToMap(request));
    }
    /**
     * 项目履约管理
     */
    @RequestMapping(value = "/listPageLy", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageLy(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMap(request));
    	return xmService.listPageLy(map);
    }
    /**
     * 项目验收根据id查询明细
     */
    @RequestMapping(value = "/getXmCheckById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmCheckById(HttpServletRequest request) {
    	return xmService.getXmCheckById(requestParameterToMap(request));
    }
    /**
     * 根据项目编号查询经济考评信息
     */
    @RequestMapping(value = "/getXmEvalByXmId", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmEvalByXmId(HttpServletRequest request) {
    	return xmService.getXmEvalByXmId(requestParameterToMap(request));
    }
    /**
     * 项目验收添加操作
     */
    @RequestMapping(value = "/addXmCheck", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXmCheck(HttpServletRequest request) {
    	
    	return xmService.addXmCheck(requestParameterToMap(request));
    }
    /**
     * 项目验收编辑操作
     */
    @RequestMapping(value = "/updateXmCheck", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXmCheck(HttpServletRequest request) {
    	
    	return xmService.updateXmCheck(requestParameterToMap(request));
    }
    /**
     * 项目履约管理
     */
    @RequestMapping(value = "/getXMLyById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXMLyById(HttpServletRequest request) {
    	return xmService.getXMLyById(requestParameterToMap(request));
    }
    /**
     * 履约添加操作
     */
    @RequestMapping(value = "/addXMLy", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXMLy(HttpServletRequest request) {
    	
    	return xmService.addXMLy(requestParameterToMap(request));
    }
    /**
     * 履约修改操作
     */
    @RequestMapping(value = "/updateXMLy", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXMLy (HttpServletRequest request) {
    	
    	return xmService.updateXMLy(requestParameterToMap(request));
    }
    /**
     * 删除履约
     * @param request
     * @return
     */
    @RequestMapping(value = "/deleteXMLy", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteXMLy(HttpServletRequest request) {
		return xmService.deleteXMLy(requestParameterToMap(request));
	}
    /**
     * 删除履约
     * @param request
     * @return
     */
    @RequestMapping(value = "/deleteXMCheck", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String deleteXMCheck(HttpServletRequest request) {
    	return xmService.deleteXMCheck(requestParameterToMap(request));
    }
    @RequestMapping(value = "/addBeforeJGMaterialDB", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addBeforeMaterialDB(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMap(request);
		Map<String, Object> sessionMap = (Map<String, Object>) request.getSession().getAttribute("LOGIN_USER");
		map.put("person_id", sessionMap.get("id"));
		map.put("person", sessionMap.get("truename"));
    	return xmService.addBeforeJGMaterialDB(map);
    }
    @RequestMapping(value = "/addBeforeJGOutMaterialDB", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addBeforeJGOutMaterialDB(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMap(request);
    	Map<String, Object> sessionMap = (Map<String, Object>) request.getSession().getAttribute("LOGIN_USER");
    	map.put("person_id", sessionMap.get("id"));
    	map.put("person", sessionMap.get("truename"));
    	return xmService.addBeforeJGOutMaterialDB(map);
    }
    /**
     * 更新甲供材入库
     * @param request
     * @return
     */
    @RequestMapping(value = "/updateBeforeJGMaterialDB", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateBeforeJGMaterialDB(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMap(request);
		Map<String, Object> sessionMap = (Map<String, Object>) request.getSession().getAttribute("LOGIN_USER");
		map.put("person_id", sessionMap.get("id"));
		map.put("person", sessionMap.get("truename"));
    	return xmService.updateBeforeJGMaterialDB(map);
    }
       
    @RequestMapping(value = "/updateBeforeJGOutMaterialDB", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateBeforeJGOutMaterialDB(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMap(request);
    	Map<String, Object> sessionMap = (Map<String, Object>) request.getSession().getAttribute("LOGIN_USER");
    	map.put("person_id", sessionMap.get("id"));
    	map.put("person", sessionMap.get("truename"));
    	return xmService.updateBeforeJGOutMaterialDB(map);
    }
    
    @RequestMapping(value = "/listPageFlowInWarehouse", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageFlowInWarehouse(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	 if(this.isAdmin(request)){ 
    	 }else{
    		 map.put("person_id", map.get("author_id"));
    	 }
    	return xmService.listPageFlowInWarehouse(map);
    }
    @RequestMapping(value = "/listPageFlowOutWarehouse", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageFlowOutWarehouse(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	if(this.isAdmin(request)){ 
    	}else{
    		map.put("person_id", map.get("author_id"));
    	}
    	return xmService.listPageFlowOutWarehouse(map);
    }
    @RequestMapping(value = "/getJGMaterial", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getJGMaterial(HttpServletRequest request) {
    	 Map<String, Object> map = requestParameterToMapUser(request);
    	 if(this.isAdmin(request)){ 
    	 }else{
    		 map.put("person_id", map.get("author_id"));
    	 }
    	return xmService.getJGMaterial(map);
    }
    @RequestMapping(value = "/getJGOutMaterial", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getJGOutMaterial(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMapUser(request);
    	if(this.isAdmin(request)){ 
    	}else{
    		map.put("person_id", map.get("author_id"));
    	}
    	return xmService.getJGOutMaterial(map);
    }
    
    @RequestMapping(value = "/getXmEvalById", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXmEvalById(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMapUser(request);
    	return xmService.getXmEvalById(map);
    }
    
    
   /**
    * 删除甲供入库
    * @param request
    * @return
    */
   @RequestMapping(value = "/deleteJGMaterial", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteJGMaterial(HttpServletRequest request) {
		return xmService.deleteJGMaterial(requestParameterToMap(request));
	}
   @RequestMapping(value = "/deleteJGOutMaterial", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
   public @ResponseBody String deleteJGOutMaterial(HttpServletRequest request) {
	   return xmService.deleteJGOutMaterial(requestParameterToMap(request));
   }
    @RequestMapping(value = "/getXMFlowInDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXMFlowInDetail(HttpServletRequest request) {
    	 Map<String, Object> map = requestParameterToMapUser(request);
    	 if(this.isAdmin(request)){ 
    	 }else{
    		 map.put("person_id", map.get("author_id"));
    	 }
    	return xmService.getXMFlowInDetail(map);
    }
    @RequestMapping(value = "/getXMFlowOutDetail", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getXMFlowOutDetail(HttpServletRequest request) {
    	Map<String, Object> map = requestParameterToMapUser(request);
    	if(this.isAdmin(request)){ 
    	}else{
    		map.put("person_id", map.get("author_id"));
    	}
    	return xmService.getXMFlowOutDetail(map);
    }
    //转移到workflowControl
//    @RequestMapping(value = "/flowBackToXMFlowInWarehouseStatus", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
//    public @ResponseBody String flowBackToXMFlowInWarehouseStatus(HttpServletRequest request) {
//    	 Map<String, Object> map = requestParameterToMapUser(request);
//    	return xmService.flowBackToXMFlowInWarehouseStatus(map);
//    }
//     
    /**
     * 删除项目
     * @param request
     * @return
     */
    @RequestMapping(value = "/deleteXm", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	public @ResponseBody String deleteXm(HttpServletRequest request) {
		return xmService.deleteXm(requestParameterToMap(request));
	} 
    /**
     * 查找待平衡项目
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/listPageXMMaterBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMMaterBalance(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	 if(this.isAdmin(request)){ 
    	 }else{
    		 map.put("person_id", map.get("author_id"));
    	 }
    	return xmService.listPageXMMaterBalance(map);
    }
    
    
    /**
     * 查找项目对应工单的材料平衡列表
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/listXMGDBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listXMGDBalance(HttpServletRequest request) {
    	return xmService.listXMGDBalance(requestParameterToMap(request));
    }
    /**
     * 查找项目对应已统计的材料平衡列表
     * @param request
     * @return
     */
    @RequestMapping(value = "/listXMGDBalanceByXmId", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listXMGDBalanceByXmId(HttpServletRequest request) {
    	return xmService.listXMGDBalanceByXmId(requestParameterToMap(request));
    }
    

    /**
     * 添加项目对应的乙供平衡列表
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/addXMGDBalance1", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXMGDBalance1(HttpServletRequest request) {
    	return xmService.addXMGDBalance1(requestParameterToMap(request));
    }
    /**
     * 添加项目对应的甲供平衡列表
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/addXMGDBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String addXMGDBalance(HttpServletRequest request) {
    	return xmService.addXMGDBalance(requestParameterToMap(request));
    }
    /**
     * 更新项目对应的乙供平衡列表
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/updateXMGDBalance1", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXMGDBalance1(HttpServletRequest request) {
    	return xmService.updateXMGDBalance1(requestParameterToMap(request));
    }
    /**
     * 更新项目对应的甲供平衡列表
     * @param request
     * @return
     */
    @RequestMapping(value = "/updateXMGDBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String updateXMGDBalance(HttpServletRequest request) {
    	return xmService.updateXMGDBalance(requestParameterToMap(request));
    }
    /**
     * 判断是否拥有平衡统计
     * @param request
     * @return
     */
    @RequestMapping(value = "/hasXMBalance", method = RequestMethod.POST, produces = "text/html;charset=UTF-8")
    public @ResponseBody String hasXMBalance(HttpServletRequest request) {
    	return xmService.hasXMBalance(requestParameterToMap(request));
    }
    

    
    /**
     * 查找待收入平衡项目
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/listPageXMInMoneyBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMInMoneyBalances(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	 if(this.isAdmin(request)){ 
    	 }else{
    		 map.put("person_id", map.get("author_id"));
    	 }
    	return xmService.listPageXMInMoneyBalance(map);
    }
    
    /**
     * 查找待支付平衡项目
     * @param request
     * @return
     */ 
    @RequestMapping(value = "/listPageXMPaymentBalance", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXMPaymentBalance(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXMPaymentBalance(map);
    } 
    
    @RequestMapping(value = "/listPageFinanceInfo", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageFinanceInfo(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageFinanceInfo(map);
    } 
    @RequestMapping(value = "/listPageWorker", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageWorker(HttpServletRequest request) {
    	Map<String, Object> map = getPagerMap(request);
    	map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageWorker(map);
    } 
    @RequestMapping(value = "/getWorkerBugdet", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String getWorkerBugdet(HttpServletRequest request) {
    	return xmService.getWorkerBugdet(requestParameterToMapUser(request));
    } 
    /**
     * 采购支付选择的项目
     * @param request
     * @return
     */
    @RequestMapping(value = "/listPageXmCg", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public @ResponseBody String listPageXmCg(HttpServletRequest request) {
    	 Map<String, Object> map = getPagerMap(request);
    	 map.putAll(requestParameterToMapUser(request));
    	return xmService.listPageXmCg(map);
    }
}
